#include "headers/Preloader.h"
#include <iostream>

int main ()
{
    Preloader& configLoader = Preloader::getInstance();
    std::string configPath = ".conf";

    /* loading & using object */
    if(configLoader.loadConfig(configPath))
    {
        std::cout << "配置内容如下:" << std::endl;
        std::cout << configLoader.getConfigContent() << std::endl;
    } else 
    {
        std::cerr << "加载配置失败" << std::endl;
    }
    
    /* validate key feature of Singleton pattern */
    auto ptr_configLoader = configLoader.getInstancePointer();

    if(ptr_configLoader == &configLoader)
        std::cout << "same object." << std::endl;
    else 
        std::cout << "different object." << std::endl;

    return 0;
}